package cn.wuqingna.legendgem.loader

import cn.wuqingna.legendgem.util.info
import cn.wuqingna.legendgem.util.listFile
import cn.wuqingna.legendgem.util.newfolder
import taboolib.common.LifeCycle
import taboolib.common.platform.Awake
import taboolib.module.configuration.Configuration
import taboolib.platform.BukkitPlugin

object GuiLoader {
    private val folder = newfolder(BukkitPlugin.getInstance().dataFolder, "gui", listOf("gui.yml"))
    val guis = mutableMapOf<String, Configuration>()

    @Awake(LifeCycle.ENABLE)
    fun init(){
        guis.clear()
        folder.listFile("yml").forEach { file ->
            val name = file.name.replace(".yml", "")
            guis[name] = Configuration.loadFromFile(file)
        }
        info(" Loader Guis §c${guis.size}§f.")
    }
}